<template>
  <div>
    <basic-container>
      <avue-form v-loading="loading" ref="form" :option="option" v-model="form">
        <template slot="supplierName">
          <el-input class="pointer" v-model="form.supplierName" @focus="openSupplier" placeholder="请选择" readonly>
            <i slot="suffix" class="el-icon-search"></i>
          </el-input>
        </template>
      </avue-form>
    </basic-container>
  </div>
</template>

<script>
import { option, supplierOption } from '@/option/tenant/supplier/temporary-form'
export default {
  name: 'TemporaryForm',
  props: ['type'],
  data() {
    return {
      form: {},
      loading: false,
      option: option.call(this)
    }
  },
  methods: {
    openSupplier() {
      this.$quickModal({
        title: '选择供应商',
        width: '900px',
        componentIsTag: true,
        component: 'suppliers',
        props: {
          multiple: false,
          columns: supplierOption
        },
        on: {
          change: row => {
            console.log(row)
          }
        }
      })
    },
    handleCancel() {
      this.$refs.form.resetForm()
      this.$emit('update:visible', false)
    }
  }
}
</script>

<style></style>
